package net.csdra.adapter;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;

import java.io.IOException;
import java.util.List;

/**
 * Created by add on 2017/10/10.
 */
public interface EMSAdapter {
    public GetBillNumBySysResponse getBillNumBySys(GetBillNumBySysRequest getBillNumBySysRequest);

    public UpdatePrintDatasResponse updatePrintDatas(UpdatePrintDatasRequest updatePrintDatasRequest) throws IOException;

    public GetTrackingInfoResponse getTrackingInfo(GetTrackingInfoRequest GetTrackingInfoReqdsuest);

    @JacksonXmlRootElement(localName= "XMLInfo")
    class GetBillNumBySysRequest extends XmlInfo {
        //业务类型，必填，1为标准快递，4为经济快递（传数字）
        String businessType;
        // 需要详情单数量，1-100之间最多输入100
        String billNoAmount;

        public String getBusinessType() {
            return businessType;
        }

        public void setBusinessType(String businessType) {
            this.businessType = businessType;
        }

        public String getBillNoAmount() {
            return billNoAmount;
        }

        public void setBillNoAmount(String billNoAmount) {
            this.billNoAmount = billNoAmount;
        }
    }

    class GetBillNumBySysResponse extends Response {

        List<AssignId> assignIds;


        public List<AssignId> getAssignIds() {
            return assignIds;
        }

        public void setAssignIds(List<AssignId> assignIds) {
            this.assignIds = assignIds;
        }
    }

    class AssignId {
        //详情单号
        String billno;

        public String getBillno() {
            return billno;
        }

        public void setBillno(String billno) {
            this.billno = billno;
        }
    }

    @JacksonXmlRootElement(localName= "XMLInfo")
    class UpdatePrintDatasRequest extends XmlInfo {
        //打印类型，1为五联单打印，2为热敏打印，必填
        String printKind;
        @JacksonXmlElementWrapper(localName = "printDatas")
        List<PrintData> printData;

        public String getPrintKind() {
            return printKind;
        }

        public void setPrintKind(String printKind) {
            this.printKind = printKind;
        }

        public List<PrintData> getPrintData() {
            return printData;
        }

        public void setPrintDatas(List<PrintData> printData) {
            this.printData = printData;
        }
    }

    class PrintData {
        String bigAccountDataId;//大客户数据的唯一标识，如某电商公司的配货单号，必填(订单如果打印条码,应为非13位数字)
        String billno;//详情单号，和配货单号对应，必填（详情单号打印条形码必须128码）
        String scontactor;//寄件人姓名
        String scustMobile;//寄件人联系方式1
        String scustTelplus;//寄件人联系方式2(选填)
        String scustPost;//寄件人邮编
        String scustAddr;//寄件人地址
        String scustComp;//寄件人公司
        String tcontactor;//收件人姓名
        String tcustMobile;//收件人联系方式1
        String tcustTelplus;//收件人联系方式2(选填)
        String tcustPost;//收件人邮编
        String tcustAddr;//收件人地址
        String tcustComp;//收件人公司
        String tcustProvince;//到件省
        String tcustCity;//到件市
        String tcustCounty;//到件县
        String weight;//寄件重量
        String length;//物品长度
        String insure;//保价，每件最高投保金额以人民币5万元为限
        String insurance;//保险
        String fee;//小写金额，代收货款和收件人付费不保留小数点；标准快递和经济快递保留两位小数点
        String feeUppercase;//大写金额（代收货款和收件人付费需要填写）
        String businessType;//业务类型，1为标准快递，2为代收货款，3为收件人付费，4为经济快递（传数字）
        String cargoDesc; //内件信息，根据货品的实际情况填写（对个别已与EMS和买家达成协议的，可只写货号，不写实际货物名称）
        String cargoType;//内件类型：（文件、物品）
        String remark;//备注
        String deliveryclaim;//对揽投员的投递要求，填写客户的个性化投递要求
        String productCode;//产品代码
        String blank1;//预留字段1
        String blank2;//预留字段2
        String blank3;//预留字段3
        String blank4;//预留字段4
        String blank5;//预留字段5

        public String getBigAccountDataId() {
            return bigAccountDataId;
        }

        public void setBigAccountDataId(String bigAccountDataId) {
            this.bigAccountDataId = bigAccountDataId;
        }

        public String getBillno() {
            return billno;
        }

        public void setBillno(String billno) {
            this.billno = billno;
        }

        public String getScontactor() {
            return scontactor;
        }

        public void setScontactor(String scontactor) {
            this.scontactor = scontactor;
        }

        public String getScustMobile() {
            return scustMobile;
        }

        public void setScustMobile(String scustMobile) {
            this.scustMobile = scustMobile;
        }

        public String getScustTelplus() {
            return scustTelplus;
        }

        public void setScustTelplus(String scustTelplus) {
            this.scustTelplus = scustTelplus;
        }

        public String getScustPost() {
            return scustPost;
        }

        public void setScustPost(String scustPost) {
            this.scustPost = scustPost;
        }

        public String getScustAddr() {
            return scustAddr;
        }

        public void setScustAddr(String scustAddr) {
            this.scustAddr = scustAddr;
        }

        public String getScustComp() {
            return scustComp;
        }

        public void setScustComp(String scustComp) {
            this.scustComp = scustComp;
        }

        public String getTcontactor() {
            return tcontactor;
        }

        public void setTcontactor(String tcontactor) {
            this.tcontactor = tcontactor;
        }

        public String getTcustMobile() {
            return tcustMobile;
        }

        public void setTcustMobile(String tcustMobile) {
            this.tcustMobile = tcustMobile;
        }

        public String getTcustTelplus() {
            return tcustTelplus;
        }

        public void setTcustTelplus(String tcustTelplus) {
            this.tcustTelplus = tcustTelplus;
        }

        public String getTcustPost() {
            return tcustPost;
        }

        public void setTcustPost(String tcustPost) {
            this.tcustPost = tcustPost;
        }

        public String getTcustAddr() {
            return tcustAddr;
        }

        public void setTcustAddr(String tcustAddr) {
            this.tcustAddr = tcustAddr;
        }

        public String getTcustComp() {
            return tcustComp;
        }

        public void setTcustComp(String tcustComp) {
            this.tcustComp = tcustComp;
        }

        public String getTcustProvince() {
            return tcustProvince;
        }

        public void setTcustProvince(String tcustProvince) {
            this.tcustProvince = tcustProvince;
        }

        public String getTcustCity() {
            return tcustCity;
        }

        public void setTcustCity(String tcustCity) {
            this.tcustCity = tcustCity;
        }

        public String getTcustCounty() {
            return tcustCounty;
        }

        public void setTcustCounty(String tcustCounty) {
            this.tcustCounty = tcustCounty;
        }

        public String getWeight() {
            return weight;
        }

        public void setWeight(String weight) {
            this.weight = weight;
        }

        public String getLength() {
            return length;
        }

        public void setLength(String length) {
            this.length = length;
        }

        public String getInsure() {
            return insure;
        }

        public void setInsure(String insure) {
            this.insure = insure;
        }

        public String getInsurance() {
            return insurance;
        }

        public void setInsurance(String insurance) {
            this.insurance = insurance;
        }

        public String getFee() {
            return fee;
        }

        public void setFee(String fee) {
            this.fee = fee;
        }

        public String getFeeUppercase() {
            return feeUppercase;
        }

        public void setFeeUppercase(String feeUppercase) {
            this.feeUppercase = feeUppercase;
        }

        public String getBusinessType() {
            return businessType;
        }

        public void setBusinessType(String businessType) {
            this.businessType = businessType;
        }

        public String getCargoDesc() {
            return cargoDesc;
        }

        public void setCargoDesc(String cargoDesc) {
            this.cargoDesc = cargoDesc;
        }

        public String getCargoType() {
            return cargoType;
        }

        public void setCargoType(String cargoType) {
            this.cargoType = cargoType;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }

        public String getDeliveryclaim() {
            return deliveryclaim;
        }

        public void setDeliveryclaim(String deliveryclaim) {
            this.deliveryclaim = deliveryclaim;
        }

        public String getProductCode() {
            return productCode;
        }

        public void setProductCode(String productCode) {
            this.productCode = productCode;
        }

        public String getBlank1() {
            return blank1;
        }

        public void setBlank1(String blank1) {
            this.blank1 = blank1;
        }

        public String getBlank2() {
            return blank2;
        }

        public void setBlank2(String blank2) {
            this.blank2 = blank2;
        }

        public String getBlank3() {
            return blank3;
        }

        public void setBlank3(String blank3) {
            this.blank3 = blank3;
        }

        public String getBlank4() {
            return blank4;
        }

        public void setBlank4(String blank4) {
            this.blank4 = blank4;
        }

        public String getBlank5() {
            return blank5;
        }

        public void setBlank5(String blank5) {
            this.blank5 = blank5;
        }
    }

    class UpdatePrintDatasResponse extends Response {

    }

    @JsonIgnoreProperties(ignoreUnknown = true)
    class GetTrackingInfoResponse {
        List <Trace> Traces;

        public List<Trace> getTraces() {
            return Traces;
        }
        public void setTraces(List<Trace> traces) {
            Traces = traces;
        }
    }

    class Trace{
        String acceptTime;
        String acceptAddress;
        String remark;

        public String getAcceptTime() {
            return acceptTime;
        }

        public void setAcceptTime(String acceptTime) {
            this.acceptTime = acceptTime;
        }

        public String getAcceptAddress() {
            return acceptAddress;
        }

        public void setAcceptAddress(String acceptAddress) {
            this.acceptAddress = acceptAddress;
        }

        public String getRemark() {
            return remark;
        }

        public void setRemark(String remark) {
            this.remark = remark;
        }
    }

    class GetTrackingInfoRequest{
        String mail_num;

        public String getMail_num() {
            return mail_num;
        }

        public void setMail_num(String mail_num) {
            this.mail_num = mail_num;
        }
    }
}
